#pragma once

#include "AERepeatKey.hpp"
#include "AEUpdateable.hpp"

BEGIN_ARETE_NAMESPACE(input)

class AEInputManager
	: public Ogre::WindowEventListener, public OIS::KeyListener, public OIS::MouseListener, public AERepeatKey, public components::AEUpdateable
{
public:
	AEInputManager(void);
	~AEInputManager(void);

	void initialize(Ogre::RenderWindow*);
	void update(float);

	OIS::InputManager* getInputManager(void);
	OIS::Keyboard* getKeyboard(void);
	OIS::Mouse* getMouse(void);

private:
	OIS::InputManager* m_inputmanager;
	OIS::Keyboard* m_keyboard;
	OIS::Mouse* m_mouse;

	float m_double_click_interval;
	float m_key_repeat_interval;

	void windowResized( Ogre::RenderWindow*);
	bool keyPressed( const OIS::KeyEvent &);
	bool keyReleased( const OIS::KeyEvent &);
	bool mouseMoved( const OIS::MouseEvent &);
	bool mousePressed( const OIS::MouseEvent &, OIS::MouseButtonID);
	bool mouseReleased( const OIS::MouseEvent &, OIS::MouseButtonID);

protected:
	void repeatKey( OIS::KeyCode,unsigned int );
};

END_ARETE_NAMESPACE